#include <stdio.h>
int main()
{
    int days = 0;
    int week = 0;
    int a = 1;
    int b = 1;
    printf("Enter number of days in month:");
    scanf("%d", &days);
    printf("Enter starting day of the week(1=Sun, 7=Sat):");
    scanf("%d", &week);
    printf(" 日 一 二 三 四 五 六\n");
    while(b < week)
    {
        b++;
        printf("   ");
    }
    while(a <= days)
    {
        if(week == 7)
        {
            printf("%3d\n", a);
            a++;
            week = 1;
        }
        else
        {
            printf("%3d", a);
            a++;
            week++;
        }
    }
    return 0;
}